package com.xiaoxi.strategymode.strategy;

import com.xiaoxi.strategymode.play.Hand;

import java.util.Random;

/**
 * @Author xiaoxi
 * @ProjectName design_mode
 * @PackageName com.xiaoxi.strategymode.strategy
 * @ClassName WinningStrategy
 * @Description TODO
 * @Date 2023/3/13 21:01
 * @Version 1.0
 */
public class WinningStrategy implements IStrategy {

    private Hand preHand;
    private boolean won;

    @Override
    public Hand nextHand() {
        if (!won) {
            preHand = Hand.getHandValue(new Random().nextInt(Hand.hands.length));
        }
        return preHand;
    }

    @Override
    public void study(boolean study) {
        this.won = study;
    }
}
